package pers.cz.logtail.handle.adapter;

import pers.cz.logtail.connect.ConnectionFactory;
import pers.cz.logtail.connect.DBType;
import pers.cz.logtail.connect.IConnection;
import pers.cz.netty.protocal.Message;

import java.util.Map;

/**
 * @program: JefLogTail
 * @description: 使用kafka保存
 * @author: Cheng Zhi
 * @create: 2023-03-04 20:50
 **/
public class KafkaAdapter extends AbstractLogSaveAdapter {

    @Override
    public void save(Message message) {
        ConnectionFactory connectionFactory = new ConnectionFactory();
        IConnection connection = connectionFactory.getConnection(DBType.KAFAKA);
        connection.insert(message.getAttachment("ip"), message.getAttachment("fileName"), (String) message.getContent());
    }
}
